<xsl:variable name="periode">periode 4</xsl:variable>
<xsl:template match='/'>  
<html>
<head> 
  <style>     
 			BODY{font-family: Garamond, Times,Arial;
      		font-weight: normal;
         	font-size: 10pt;
        	line-height:12pt}
     	TD{font-family: Garamond, Times, Arial;
        	font-weight: normal;
        	font-size: 10pt;
        	line-height:12pt;
        	text-align:center}
     TH{font-family: Garamond, Times, Arial;
        	font-weight: bold;
        	font-size: 10pt;
        	line-height:12pt;
        	text-align:center}
    .lln {font-family: Garamond, Times, Arial;
        	font-weight: bold;
        	font-size: 10pt;
        	line-height:12pt;
        	text-align:left}       	
    TABLE{border-collapse: collapse;
        	margin-top:0.1cm}
        
   </style>  
</head>  
<body>
<table border='1'>
<tr width="90%"><th colspan='100'>Overzicht maandcijfers <xsl:value-of select='$periode' /></th></tr>
<tr><th /><xsl:for-each select="//rapport[1]/vakken/*">
    <xsl:call-template name="vakken" />
    </xsl:for-each><th></th><th>TOT</th></tr>
<xsl:apply-templates select='//rapport/leerling'/>
<tr><th colspan="100"></th></tr>
<tr><th class="lln">Gemiddelde</th><xsl:for-each select="//rapport[1]/vakken/*/c4gem">
      <xsl:call-template name="kleur" />
    </xsl:for-each>
    <th></th>
    <xsl:for-each select="//rapport[1]/totaal/tot4gem">
      <xsl:call-template name="kleur" />
    </xsl:for-each>
</tr> 
</table>	  
</body>	   
</html>
</xsl:template>

<xsl:template name="vakken">
  <th><xsl:value-of select="name()" /></th>
</xsl:template>

<xsl:template match='leerling'>
  <tr>
    <th width="25%" class="lln"><xsl:value-of select="voornaam" />&#160;<xsl:value-of select="achternaam" /> </th>
    <xsl:for-each select="../vakken/*/c4">
      <xsl:call-template name="kleur" />
    </xsl:for-each>
    <td></td>
    <xsl:for-each select="../totaal/tot4">
      <xsl:call-template name="kleur" />
    </xsl:for-each>
  </tr>
</xsl:template>  

<xsl:template name="kleur">
  <td>
    <font>
      <xsl:attribute name="color">
		    <xsl:choose>
	  				<xsl:when test=". &lt; 50">#ff0000</xsl:when>
	  				<xsl:otherwise>black</xsl:otherwise>
		    </xsl:choose>
  	  </xsl:attribute>	
      <xsl:value-of select="." />
    </font>
  </td>
</xsl:template>
